<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Secure Sockets: Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="cypress_logo.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Secure Sockets</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__group__secure__sockets__functions.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">Functions<div class="ingroups"><a class="el" href="group__group__secure__sockets.html">Secure Sockets API</a></div></div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p >All API functions except <a class="el" href="group__group__secure__sockets__functions.html#ga49a49b4e3b4293aa3855f47ce831ebe2">cy_socket_init</a> and <a class="el" href="group__group__secure__sockets__functions.html#ga0eb3e8e31c5a1c11c08ac35807bb5680">cy_socket_deinit</a> are thread-safe. </p>
<p >All API functions are blocking API functions.</p>
<p >Secure Sockets Library creates a worker thread for processing events from the network stack. The priority of the thread is CY_RTOS_PRIORITY_ABOVENORMAL. The macro CY_RTOS_PRIORITY_ABOVENORMAL is defined in abstraction-rtos/include/COMPONENT_FREERTOS/cyabs_rtos_impl.h. </p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga49a49b4e3b4293aa3855f47ce831ebe2"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga49a49b4e3b4293aa3855f47ce831ebe2">cy_socket_init</a> (void)</td></tr>
<tr class="memdesc:ga49a49b4e3b4293aa3855f47ce831ebe2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Does general allocation and initialization of resources needed for the library.  <a href="group__group__secure__sockets__functions.html#ga49a49b4e3b4293aa3855f47ce831ebe2">More...</a><br /></td></tr>
<tr class="separator:ga49a49b4e3b4293aa3855f47ce831ebe2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0eb3e8e31c5a1c11c08ac35807bb5680"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga0eb3e8e31c5a1c11c08ac35807bb5680">cy_socket_deinit</a> (void)</td></tr>
<tr class="memdesc:ga0eb3e8e31c5a1c11c08ac35807bb5680"><td class="mdescLeft">&#160;</td><td class="mdescRight">Releases the resources allocated in <a class="el" href="group__group__secure__sockets__functions.html#ga49a49b4e3b4293aa3855f47ce831ebe2">cy_socket_init</a> function.  <a href="group__group__secure__sockets__functions.html#ga0eb3e8e31c5a1c11c08ac35807bb5680">More...</a><br /></td></tr>
<tr class="separator:ga0eb3e8e31c5a1c11c08ac35807bb5680"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga30bbbf20a277e2a7e622df504b014a4b"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> (int domain, int type, int protocol, <a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> *handle)</td></tr>
<tr class="memdesc:ga30bbbf20a277e2a7e622df504b014a4b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new socket.  <a href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">More...</a><br /></td></tr>
<tr class="separator:ga30bbbf20a277e2a7e622df504b014a4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2e07189d60c7e6a130302d2e2db19653"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga2e07189d60c7e6a130302d2e2db19653">cy_socket_connect</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> *address, uint32_t address_length)</td></tr>
<tr class="memdesc:ga2e07189d60c7e6a130302d2e2db19653"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connects a TCP/TLS socket to the specified server IP address and port.  <a href="group__group__secure__sockets__functions.html#ga2e07189d60c7e6a130302d2e2db19653">More...</a><br /></td></tr>
<tr class="separator:ga2e07189d60c7e6a130302d2e2db19653"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga97476da4dcc2f3a411c35b741bf098cc"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga97476da4dcc2f3a411c35b741bf098cc">cy_socket_disconnect</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, uint32_t timeout)</td></tr>
<tr class="memdesc:ga97476da4dcc2f3a411c35b741bf098cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disconnects a TCP/TLS socket's remote connection.  <a href="group__group__secure__sockets__functions.html#ga97476da4dcc2f3a411c35b741bf098cc">More...</a><br /></td></tr>
<tr class="separator:ga97476da4dcc2f3a411c35b741bf098cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac05772b8936d96ec8d8367b661912608"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#gac05772b8936d96ec8d8367b661912608">cy_socket_bind</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> *address, uint32_t address_length)</td></tr>
<tr class="memdesc:gac05772b8936d96ec8d8367b661912608"><td class="mdescLeft">&#160;</td><td class="mdescRight">Binds the socket to the given socket address.  <a href="group__group__secure__sockets__functions.html#gac05772b8936d96ec8d8367b661912608">More...</a><br /></td></tr>
<tr class="separator:gac05772b8936d96ec8d8367b661912608"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1d5c6e81830f6c81f820e02f6d0cf6a0"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga1d5c6e81830f6c81f820e02f6d0cf6a0">cy_socket_listen</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, int backlog)</td></tr>
<tr class="memdesc:ga1d5c6e81830f6c81f820e02f6d0cf6a0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Listens for TCP/TLS socket connections and limits the queue of incoming connections.  <a href="group__group__secure__sockets__functions.html#ga1d5c6e81830f6c81f820e02f6d0cf6a0">More...</a><br /></td></tr>
<tr class="separator:ga1d5c6e81830f6c81f820e02f6d0cf6a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga49ede56f180b2bb3e367924f535bb300"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga49ede56f180b2bb3e367924f535bb300">cy_socket_accept</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> *address, uint32_t *address_length, <a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> *socket)</td></tr>
<tr class="memdesc:ga49ede56f180b2bb3e367924f535bb300"><td class="mdescLeft">&#160;</td><td class="mdescRight">Accepts a new TCP/TLS connection on a socket.  <a href="group__group__secure__sockets__functions.html#ga49ede56f180b2bb3e367924f535bb300">More...</a><br /></td></tr>
<tr class="separator:ga49ede56f180b2bb3e367924f535bb300"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf6ba24a0e4e6eb3c24087938aa3ae021"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#gaf6ba24a0e4e6eb3c24087938aa3ae021">cy_socket_send</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, const void *buffer, uint32_t length, int flags, uint32_t *bytes_sent)</td></tr>
<tr class="memdesc:gaf6ba24a0e4e6eb3c24087938aa3ae021"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends data over a connected TCP/TLS socket.  <a href="group__group__secure__sockets__functions.html#gaf6ba24a0e4e6eb3c24087938aa3ae021">More...</a><br /></td></tr>
<tr class="separator:gaf6ba24a0e4e6eb3c24087938aa3ae021"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4bc4e8aed9916206f073cb22cf4009cc"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga4bc4e8aed9916206f073cb22cf4009cc">cy_socket_sendto</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, const void *buffer, uint32_t length, int flags, const <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> *dest_addr, uint32_t address_length, uint32_t *bytes_sent)</td></tr>
<tr class="memdesc:ga4bc4e8aed9916206f073cb22cf4009cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a UDP datagram over a specified socket.  <a href="group__group__secure__sockets__functions.html#ga4bc4e8aed9916206f073cb22cf4009cc">More...</a><br /></td></tr>
<tr class="separator:ga4bc4e8aed9916206f073cb22cf4009cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaeb1269bd36384293539dc749095412f7"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#gaeb1269bd36384293539dc749095412f7">cy_socket_recv</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, void *buffer, uint32_t length, int flags, uint32_t *bytes_received)</td></tr>
<tr class="memdesc:gaeb1269bd36384293539dc749095412f7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Receives the data from a connected TCP/TLS socket.  <a href="group__group__secure__sockets__functions.html#gaeb1269bd36384293539dc749095412f7">More...</a><br /></td></tr>
<tr class="separator:gaeb1269bd36384293539dc749095412f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga29df5cbdaa9de0f324cf947454577727"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga29df5cbdaa9de0f324cf947454577727">cy_socket_recvfrom</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, void *buffer, uint32_t length, int flags, <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> *src_addr, uint32_t *src_addr_length, uint32_t *bytes_received)</td></tr>
<tr class="memdesc:ga29df5cbdaa9de0f324cf947454577727"><td class="mdescLeft">&#160;</td><td class="mdescRight">Receives a UDP datagram for the specified socket.  <a href="group__group__secure__sockets__functions.html#ga29df5cbdaa9de0f324cf947454577727">More...</a><br /></td></tr>
<tr class="separator:ga29df5cbdaa9de0f324cf947454577727"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga02e453d715d77075c59d751f6b07ae8f"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga02e453d715d77075c59d751f6b07ae8f">cy_socket_setsockopt</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, int level, int optname, const void *optval, uint32_t optlen)</td></tr>
<tr class="memdesc:ga02e453d715d77075c59d751f6b07ae8f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets a particular socket option.  <a href="group__group__secure__sockets__functions.html#ga02e453d715d77075c59d751f6b07ae8f">More...</a><br /></td></tr>
<tr class="separator:ga02e453d715d77075c59d751f6b07ae8f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa417ff64790869ca839134b636d0f473"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#gaa417ff64790869ca839134b636d0f473">cy_socket_getsockopt</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, int level, int optname, void *optval, uint32_t *optlen)</td></tr>
<tr class="memdesc:gaa417ff64790869ca839134b636d0f473"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the value of a particular socket option.  <a href="group__group__secure__sockets__functions.html#gaa417ff64790869ca839134b636d0f473">More...</a><br /></td></tr>
<tr class="separator:gaa417ff64790869ca839134b636d0f473"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaeb05bcbd775c36f5fe3fe9d676329494"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#gaeb05bcbd775c36f5fe3fe9d676329494">cy_socket_gethostbyname</a> (const char *hostname, <a class="el" href="group__group__secure__sockets__enums.html#ga97cb501a58195859467b126cf2a2789d">cy_socket_ip_version_t</a> ip_ver, <a class="el" href="structcy__socket__ip__address__t.html">cy_socket_ip_address_t</a> *addr)</td></tr>
<tr class="memdesc:gaeb05bcbd775c36f5fe3fe9d676329494"><td class="mdescLeft">&#160;</td><td class="mdescRight">Resolves a host name using Domain Name Service.  <a href="group__group__secure__sockets__functions.html#gaeb05bcbd775c36f5fe3fe9d676329494">More...</a><br /></td></tr>
<tr class="separator:gaeb05bcbd775c36f5fe3fe9d676329494"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3c548fdcc908089b8ff95ad210f4fb64"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga3c548fdcc908089b8ff95ad210f4fb64">cy_socket_poll</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, uint32_t *rwflags, uint32_t timeout)</td></tr>
<tr class="memdesc:ga3c548fdcc908089b8ff95ad210f4fb64"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks whether data is available on the socket.  <a href="group__group__secure__sockets__functions.html#ga3c548fdcc908089b8ff95ad210f4fb64">More...</a><br /></td></tr>
<tr class="separator:ga3c548fdcc908089b8ff95ad210f4fb64"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5d118a0eaac0384adc34fccfe89c2b8f"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga5d118a0eaac0384adc34fccfe89c2b8f">cy_socket_shutdown</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle, int how)</td></tr>
<tr class="memdesc:ga5d118a0eaac0384adc34fccfe89c2b8f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Shuts down the send and/or receive operation on the given TCP socket.  <a href="group__group__secure__sockets__functions.html#ga5d118a0eaac0384adc34fccfe89c2b8f">More...</a><br /></td></tr>
<tr class="separator:ga5d118a0eaac0384adc34fccfe89c2b8f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3c811410848871c3c4b0721a3b37dc24"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__secure__sockets__functions.html#ga3c811410848871c3c4b0721a3b37dc24">cy_socket_delete</a> (<a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> handle)</td></tr>
<tr class="memdesc:ga3c811410848871c3c4b0721a3b37dc24"><td class="mdescLeft">&#160;</td><td class="mdescRight">Releases the resources allocated for the socket by the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> function.  <a href="group__group__secure__sockets__functions.html#ga3c811410848871c3c4b0721a3b37dc24">More...</a><br /></td></tr>
<tr class="separator:ga3c811410848871c3c4b0721a3b37dc24"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga49a49b4e3b4293aa3855f47ce831ebe2" name="ga49a49b4e3b4293aa3855f47ce831ebe2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga49a49b4e3b4293aa3855f47ce831ebe2">&#9670;&nbsp;</a></span>cy_socket_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Does general allocation and initialization of resources needed for the library. </p>
<p >This API function must be called before using any other socket API.</p>
<dl class="section note"><dt>Note</dt><dd><a class="el" href="group__group__secure__sockets__functions.html#ga49a49b4e3b4293aa3855f47ce831ebe2">cy_socket_init</a> and <a class="el" href="group__group__secure__sockets__functions.html#ga0eb3e8e31c5a1c11c08ac35807bb5680">cy_socket_deinit</a> API functions are not thread-safe. The caller must ensure that these two API functions are not invoked simultaneously from different threads. </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. </dd></dl>

</div>
</div>
<a id="ga0eb3e8e31c5a1c11c08ac35807bb5680" name="ga0eb3e8e31c5a1c11c08ac35807bb5680"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0eb3e8e31c5a1c11c08ac35807bb5680">&#9670;&nbsp;</a></span>cy_socket_deinit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_deinit </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Releases the resources allocated in <a class="el" href="group__group__secure__sockets__functions.html#ga49a49b4e3b4293aa3855f47ce831ebe2">cy_socket_init</a> function. </p>
<p >Prior to calling this API function, all created sockets must be disconnected and deleted.</p>
<dl class="section note"><dt>Note</dt><dd><a class="el" href="group__group__secure__sockets__functions.html#ga49a49b4e3b4293aa3855f47ce831ebe2">cy_socket_init</a> and <a class="el" href="group__group__secure__sockets__functions.html#ga0eb3e8e31c5a1c11c08ac35807bb5680">cy_socket_deinit</a> API functions are not thread-safe. The caller must ensure that these two API functions are not invoked simultaneously from different threads.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. Important error code related to this API function is: <a class="el" href="group__group__secure__sockets__results.html#gaa6993d25f240ea318b81be9c1dbb1262">CY_RSLT_MODULE_SECURE_SOCKETS_NOT_INITIALIZED</a> </dd></dl>

</div>
</div>
<a id="ga30bbbf20a277e2a7e622df504b014a4b" name="ga30bbbf20a277e2a7e622df504b014a4b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga30bbbf20a277e2a7e622df504b014a4b">&#9670;&nbsp;</a></span>cy_socket_create()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_create </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>domain</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>protocol</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> *&#160;</td>
          <td class="paramname"><em>handle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a new socket. </p>
<dl class="section note"><dt>Note</dt><dd><ol type="1">
<li><a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create()</a> function creates a dual-stack socket if domain passed is <a class="el" href="group__group__secure__sockets__macros.html#gaa2d04e27350109a0084d8ea90eb24a27">CY_SOCKET_DOMAIN_AF_INET6</a>.</li>
<li>Secure Sockets Library configures default send and receive timeout values to 10 seconds for a newly created socket. These default values can be overridden using the <a class="el" href="group__group__secure__sockets__functions.html#ga02e453d715d77075c59d751f6b07ae8f">cy_socket_setsockopt</a> API. Adjust the default timeout values based on the network speed or use case. For example, to change the send timeout, use the <a class="el" href="group__group__secure__sockets__macros.html#ga6d99d154509bf7293f13ac97b7fd5b68">CY_SOCKET_SO_SNDTIMEO</a> socket option; similarly, for receive timeout, use the <a class="el" href="group__group__secure__sockets__macros.html#ga1fcbd0b7ab0d808a7d0a88eaffe04e00">CY_SOCKET_SO_RCVTIMEO</a> socket option.</li>
<li>Secure Socket Library sets default TLS authentication mode for TLS client sockets to <a class="el" href="group__group__secure__sockets__enums.html#ggaf0599f554a1154ae83b4f587520fa705a68f0cd442bb9f64416a6351f6d8c5a78">CY_SOCKET_TLS_VERIFY_REQUIRED</a>. For TLS server sockets, it sets the default TLS authentication mode to CY_SOCKET_TLS_VERIFY_NONE. To override the default authentication mode, use <a class="el" href="group__group__secure__sockets__functions.html#ga02e453d715d77075c59d751f6b07ae8f">cy_socket_setsockopt</a> with the <a class="el" href="group__group__secure__sockets__macros.html#ga9ce4ab8fca2ff7306f05f7433835f394">CY_SOCKET_SO_TLS_AUTH_MODE</a> socket option.</li>
<li>To use a socket for multicast operations over SoftAP interface, user must bind the socket to the SoftAP interface using <a class="el" href="group__group__secure__sockets__macros.html#ga9bcc73d3e5fd22f8cceb98f57507703d">CY_SOCKET_SO_BINDTODEVICE</a> socket option after creating the socket.</li>
</ol>
</dd></dl>
<p>Valid type/protocol combinations are:</p><ul>
<li><a class="el" href="group__group__secure__sockets__macros.html#gac0610ba6e8fe01ccbaacf89145f9285a">CY_SOCKET_TYPE_STREAM</a> with <a class="el" href="group__group__secure__sockets__macros.html#ga1c6d23edbc333c85d3e7a8702dcf22a1">CY_SOCKET_IPPROTO_TCP</a> or <a class="el" href="group__group__secure__sockets__macros.html#ga1114a6ecf098cf499e2c9ad3d651efc3">CY_SOCKET_IPPROTO_TLS</a></li>
<li><a class="el" href="group__group__secure__sockets__macros.html#ga9ea5c6f97612e469393306ddefc38657">CY_SOCKET_TYPE_DGRAM</a> with <a class="el" href="group__group__secure__sockets__macros.html#ga2bbff715a00d6ce5ff669b12a75c7441">CY_SOCKET_IPPROTO_UDP</a></li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">domain</td><td>Protocol family to be used by the socket. Refer <a class="el" href="group__group__secure__sockets__macros.html#gacc301fb73845cb915cfacffc1b7d0c23">CY_SOCKET_DOMAIN_AF_INET</a> and <a class="el" href="group__group__secure__sockets__macros.html#gaa2d04e27350109a0084d8ea90eb24a27">CY_SOCKET_DOMAIN_AF_INET6</a>. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">type</td><td>Protocol type to be used by the socket. Refer <a class="el" href="group__group__secure__sockets__macros.html#ga9ea5c6f97612e469393306ddefc38657">CY_SOCKET_TYPE_DGRAM</a> and <a class="el" href="group__group__secure__sockets__macros.html#gac0610ba6e8fe01ccbaacf89145f9285a">CY_SOCKET_TYPE_STREAM</a>. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">protocol</td><td>Transport protocol to be used by the socket. Refer <a class="el" href="group__group__secure__sockets__macros.html#ga1c6d23edbc333c85d3e7a8702dcf22a1">CY_SOCKET_IPPROTO_TCP</a>, <a class="el" href="group__group__secure__sockets__macros.html#ga2bbff715a00d6ce5ff669b12a75c7441">CY_SOCKET_IPPROTO_UDP</a>, and <a class="el" href="group__group__secure__sockets__macros.html#ga1114a6ecf098cf499e2c9ad3d651efc3">CY_SOCKET_IPPROTO_TLS</a>. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">handle</td><td>Socket handle; contents of this handle are specific to the socket layer implementation. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. On success, it also returns the socket handle. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga11aea8ad5dfd9ea5de446b30d6db82d6">CY_RSLT_MODULE_SECURE_SOCKETS_BADARG</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga7631cf4765aea807ee7eef6628ea962c">CY_RSLT_MODULE_SECURE_SOCKETS_NOMEM</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga124cf86b625393915202c81b9873fcde">CY_RSLT_MODULE_SECURE_SOCKETS_NETIF_DOES_NOT_EXIST</a> </dd></dl>

</div>
</div>
<a id="ga2e07189d60c7e6a130302d2e2db19653" name="ga2e07189d60c7e6a130302d2e2db19653"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2e07189d60c7e6a130302d2e2db19653">&#9670;&nbsp;</a></span>cy_socket_connect()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_connect </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> *&#160;</td>
          <td class="paramname"><em>address</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>address_length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Connects a TCP/TLS socket to the specified server IP address and port. </p>
<p >This API function is a blocking call.</p>
<p >For secure (TLS) sockets, before calling this API function, the following TLS configuration can be set:</p><ol type="1">
<li>RootCA using the <a class="el" href="group__group__cy__tls__functions.html#ga186918ab7a9c658fb7e3cc6f00e0d6d9">cy_tls_load_global_root_ca_certificates</a> or <a class="el" href="group__group__secure__sockets__functions.html#ga02e453d715d77075c59d751f6b07ae8f">cy_socket_setsockopt</a> API function with <a class="el" href="group__group__secure__sockets__macros.html#ga5bdbb8938476af809b4af8f5f7c2da2d">CY_SOCKET_SO_TRUSTED_ROOTCA_CERTIFICATE</a>.</li>
<li>Certificate/key pair with <a class="el" href="group__group__cy__tls__functions.html#ga3d2408681bbcea3b869cb5ae21cd0d5e">cy_tls_create_identity</a> and <a class="el" href="group__group__secure__sockets__functions.html#ga02e453d715d77075c59d751f6b07ae8f">cy_socket_setsockopt</a> with <a class="el" href="group__group__secure__sockets__macros.html#gafa0ac839774a33feeb037dbb0c449cc3">CY_SOCKET_SO_TLS_IDENTITY</a>.</li>
<li>For TLS client sockets, the default authentication mode set is <a class="el" href="group__group__secure__sockets__enums.html#ggaf0599f554a1154ae83b4f587520fa705a68f0cd442bb9f64416a6351f6d8c5a78">CY_SOCKET_TLS_VERIFY_REQUIRED</a>. To override the default authentication mode, use <a class="el" href="group__group__secure__sockets__functions.html#ga02e453d715d77075c59d751f6b07ae8f">cy_socket_setsockopt</a> with the <a class="el" href="group__group__secure__sockets__macros.html#ga9ce4ab8fca2ff7306f05f7433835f394">CY_SOCKET_SO_TLS_AUTH_MODE</a> socket option.</li>
<li>The default mbed TLS configuration provided by the <em>Wi-Fi Middleware Core Library</em> disables the validity period verification of the certificates. To perform this verification, enable MBEDTLS_HAVE_TIME_DATE in the <a href="https://github.com/infineon/wifi-mw-core/blob/master/configs/mbedtls_user_config.h">mbedtls_user_config.h</a> file. Ensure that the system time is set prior to the <a class="el" href="group__group__secure__sockets__functions.html#ga2e07189d60c7e6a130302d2e2db19653">cy_socket_connect()</a> function call. To set the system time, get the time from the NTP server and set the system's RTC time using cyhal_rtc_init(), cyhal_rtc_write() and cy_set_rtc_instance() functions. See the <a href="https://github.com/infineon/clib-support/blob/master/README.md#time-support-details">Time Support Details</a> for reference. See the <a class="el" href="index.html#snip12">Code Snippet 12: Get the current time from the NTP server - Send an NTP request packet to the NTP server, and receive an NTP reply packet.</a> to get the time from NTP server.</li>
</ol>
<dl class="section note"><dt>Note</dt><dd>This is applicable if Secure Sockets Library is built for lwIP network stack. If this function returns <a class="el" href="group__group__secure__sockets__results.html#gaae6a87e885601b640fba5752a8ec29b4">CY_RSLT_MODULE_SECURE_SOCKETS_CLOSED</a> error, the socket handle cannot be reused to establish the connection. The caller should invoke <a class="el" href="group__group__secure__sockets__functions.html#ga3c811410848871c3c4b0721a3b37dc24">cy_socket_delete</a> API function to delete the current socket handle, and create a new socket handle using <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> API function to re-establish the connection. This is required, due to the limitation of lwIP stack.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle returned by the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> API function. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">address</td><td>Pointer to the <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> structure that contains the address to connect the socket to. Refer <a class="el" href="structcy__socket__ip__address__t.html">cy_socket_ip_address_t</a> for IP address endienness. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">address_length</td><td>Length of the <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> structure.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga11aea8ad5dfd9ea5de446b30d6db82d6">CY_RSLT_MODULE_SECURE_SOCKETS_BADARG</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gaa1e29599b933b3e95c49b4a680832f67">CY_RSLT_MODULE_SECURE_SOCKETS_TLS_ERROR</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gae7076deaa42ba4f0c9e80d6d807ecdea">CY_RSLT_MODULE_SECURE_SOCKETS_TCPIP_ERROR</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gac5f5fb81bfb98a38b7b36981f1be2ac7">CY_RSLT_MODULE_SECURE_SOCKETS_TIMEOUT</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga7631cf4765aea807ee7eef6628ea962c">CY_RSLT_MODULE_SECURE_SOCKETS_NOMEM</a> </dd></dl>

</div>
</div>
<a id="ga97476da4dcc2f3a411c35b741bf098cc" name="ga97476da4dcc2f3a411c35b741bf098cc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga97476da4dcc2f3a411c35b741bf098cc">&#9670;&nbsp;</a></span>cy_socket_disconnect()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_disconnect </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disconnects a TCP/TLS socket's remote connection. </p>
<p >Timeout is not supported by all network stacks. If the underlying network stack does not support the timeout option, this function returns after a clean disconnect. lwIP does not support the timeout option.</p>
<dl class="section note"><dt>Note</dt><dd>Ensure that this API function is also called when the socket send/receive API fails with the error <a class="el" href="group__group__secure__sockets__results.html#gaae6a87e885601b640fba5752a8ec29b4">CY_RSLT_MODULE_SECURE_SOCKETS_CLOSED</a>.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle returned by either the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> API function for client sockets, or by the <a class="el" href="group__group__secure__sockets__functions.html#ga49ede56f180b2bb3e367924f535bb300">cy_socket_accept</a> API function for accepted sockets.</td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td>Maximum amount of time to wait in milliseconds for a clean disconnect. When the timeout is zero, the function returns after a clean disconnect or when the operation results in an error.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga76b8e494a5c48cb3fb8d84a9a2f200ba">CY_RSLT_MODULE_SECURE_SOCKETS_NOT_CONNECTED</a> </dd></dl>

</div>
</div>
<a id="gac05772b8936d96ec8d8367b661912608" name="gac05772b8936d96ec8d8367b661912608"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac05772b8936d96ec8d8367b661912608">&#9670;&nbsp;</a></span>cy_socket_bind()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_bind </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> *&#160;</td>
          <td class="paramname"><em>address</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>address_length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Binds the socket to the given socket address. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle returned by the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> API function. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">address</td><td>Address to be bound to the socket. Refer <a class="el" href="structcy__socket__ip__address__t.html">cy_socket_ip_address_t</a> for IP address endienness. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">address_length</td><td>Length of the <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> structure.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga11aea8ad5dfd9ea5de446b30d6db82d6">CY_RSLT_MODULE_SECURE_SOCKETS_BADARG</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gae7076deaa42ba4f0c9e80d6d807ecdea">CY_RSLT_MODULE_SECURE_SOCKETS_TCPIP_ERROR</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga7631cf4765aea807ee7eef6628ea962c">CY_RSLT_MODULE_SECURE_SOCKETS_NOMEM</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gadbf2f8f83f4bd800effdd3e58a266ceb">CY_RSLT_MODULE_SECURE_SOCKETS_PROTOCOL_NOT_SUPPORTED</a> </dd></dl>

</div>
</div>
<a id="ga1d5c6e81830f6c81f820e02f6d0cf6a0" name="ga1d5c6e81830f6c81f820e02f6d0cf6a0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1d5c6e81830f6c81f820e02f6d0cf6a0">&#9670;&nbsp;</a></span>cy_socket_listen()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_listen </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>backlog</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Listens for TCP/TLS socket connections and limits the queue of incoming connections. </p>
<p >If the socket has been configured with a connection request callback, the registered callback will be invoked when the new client connection request is received. Invoke the <a class="el" href="group__group__secure__sockets__functions.html#ga49ede56f180b2bb3e367924f535bb300">cy_socket_accept</a> API function from the callback function to accept the client connection.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle returned by the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> API function. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">backlog</td><td>Maximum pending connections allowed.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga11aea8ad5dfd9ea5de446b30d6db82d6">CY_RSLT_MODULE_SECURE_SOCKETS_BADARG</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gae7076deaa42ba4f0c9e80d6d807ecdea">CY_RSLT_MODULE_SECURE_SOCKETS_TCPIP_ERROR</a> </dd></dl>

</div>
</div>
<a id="ga49ede56f180b2bb3e367924f535bb300" name="ga49ede56f180b2bb3e367924f535bb300"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga49ede56f180b2bb3e367924f535bb300">&#9670;&nbsp;</a></span>cy_socket_accept()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_accept </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> *&#160;</td>
          <td class="paramname"><em>address</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>address_length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a> *&#160;</td>
          <td class="paramname"><em>socket</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Accepts a new TCP/TLS connection on a socket. </p>
<p >This is a blocking API function that returns when there is an incoming connection request from a client.</p>
<p >However, when the <a class="el" href="group__group__secure__sockets__macros.html#ga1fcbd0b7ab0d808a7d0a88eaffe04e00">CY_SOCKET_SO_RCVTIMEO</a> socket option is set on the listening socket (input socket handle param), this API function returns with a <a class="el" href="group__group__secure__sockets__results.html#gac5f5fb81bfb98a38b7b36981f1be2ac7">CY_RSLT_MODULE_SECURE_SOCKETS_TIMEOUT</a> error if there is no connection request from a client within the timeout period.</p>
<p ><a class="el" href="group__group__secure__sockets__macros.html#ga1fcbd0b7ab0d808a7d0a88eaffe04e00">CY_SOCKET_SO_RCVTIMEO</a> can be set using the <a class="el" href="group__group__secure__sockets__functions.html#ga02e453d715d77075c59d751f6b07ae8f">cy_socket_setsockopt</a> API function.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle that has been created with <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a>, bound to a local address with <a class="el" href="group__group__secure__sockets__functions.html#gac05772b8936d96ec8d8367b661912608">cy_socket_bind</a>, and is listening for connections after a call to <a class="el" href="group__group__secure__sockets__functions.html#ga1d5c6e81830f6c81f820e02f6d0cf6a0">cy_socket_listen</a>. This is the server-side socket that is reused to establish connections across clients. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">address</td><td>Address of the peer socket in the <a class="el" href="structcy__socket__sockaddr__t.html" title="Socket Address.">cy_socket_sockaddr_t</a> structure. Refer <a class="el" href="structcy__socket__ip__address__t.html">cy_socket_ip_address_t</a> for IP address endienness. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">address_length</td><td>Contains the actual size of the peer socket address. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">socket</td><td>Socket handle for the accepted connection with a client. This is the socket that should be used for further communication over a new client connection.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gaa1e29599b933b3e95c49b4a680832f67">CY_RSLT_MODULE_SECURE_SOCKETS_TLS_ERROR</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gac5f5fb81bfb98a38b7b36981f1be2ac7">CY_RSLT_MODULE_SECURE_SOCKETS_TIMEOUT</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga7631cf4765aea807ee7eef6628ea962c">CY_RSLT_MODULE_SECURE_SOCKETS_NOMEM</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga11aea8ad5dfd9ea5de446b30d6db82d6">CY_RSLT_MODULE_SECURE_SOCKETS_BADARG</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gadc88f329a4d4bd26dc57e5a613c12a4f">CY_RSLT_MODULE_SECURE_SOCKETS_NOT_LISTENING</a> </dd></dl>

</div>
</div>
<a id="gaf6ba24a0e4e6eb3c24087938aa3ae021" name="gaf6ba24a0e4e6eb3c24087938aa3ae021"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf6ba24a0e4e6eb3c24087938aa3ae021">&#9670;&nbsp;</a></span>cy_socket_send()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_send </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flags</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>bytes_sent</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sends data over a connected TCP/TLS socket. </p>
<dl class="section note"><dt>Note</dt><dd>Ensure that the <a class="el" href="group__group__secure__sockets__functions.html#ga97476da4dcc2f3a411c35b741bf098cc">cy_socket_disconnect</a> API function is called when this API function fails with the CY_RSLT_MODULE_SECURE_SOCKETS_CLOSED error. lwIP doesn't allow the socket to be reused after disconnection. Therefore, the caller should call <a class="el" href="group__group__secure__sockets__functions.html#ga97476da4dcc2f3a411c35b741bf098cc">cy_socket_disconnect</a> and <a class="el" href="group__group__secure__sockets__functions.html#ga3c811410848871c3c4b0721a3b37dc24">cy_socket_delete</a> API functions to delete the closed socket. This is applicable if Secure Sockets Library is built for lwIP network stack.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle returned by either the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> API function for client sockets, or by the <a class="el" href="group__group__secure__sockets__functions.html#ga49ede56f180b2bb3e367924f535bb300">cy_socket_accept</a> API function for accepted sockets. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">buffer</td><td>Buffer containing the data to be sent. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>Length of the data to be sent. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">flags</td><td>Flags to indicate the send options: <a class="el" href="group__group__secure__sockets__macros.html#ga91444208828cd6b96895d64b879513d4">CY_SOCKET_FLAGS_NONE</a> and <a class="el" href="group__group__secure__sockets__macros.html#ga41fcdecad22d4585c47271f11d23a147">CY_SOCKET_FLAGS_MORE</a> </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">bytes_sent</td><td>Number of bytes sent.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. On success, it also returns the number of bytes sent. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gaa1e29599b933b3e95c49b4a680832f67">CY_RSLT_MODULE_SECURE_SOCKETS_TLS_ERROR</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gae7076deaa42ba4f0c9e80d6d807ecdea">CY_RSLT_MODULE_SECURE_SOCKETS_TCPIP_ERROR</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gac5f5fb81bfb98a38b7b36981f1be2ac7">CY_RSLT_MODULE_SECURE_SOCKETS_TIMEOUT</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga76b8e494a5c48cb3fb8d84a9a2f200ba">CY_RSLT_MODULE_SECURE_SOCKETS_NOT_CONNECTED</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gaae6a87e885601b640fba5752a8ec29b4">CY_RSLT_MODULE_SECURE_SOCKETS_CLOSED</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga40143a1ca502f18baf2fc6ea9e48d1a6">CY_RSLT_MODULE_SECURE_SOCKETS_WOULDBLOCK</a> </dd></dl>

</div>
</div>
<a id="ga4bc4e8aed9916206f073cb22cf4009cc" name="ga4bc4e8aed9916206f073cb22cf4009cc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4bc4e8aed9916206f073cb22cf4009cc">&#9670;&nbsp;</a></span>cy_socket_sendto()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_sendto </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flags</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> *&#160;</td>
          <td class="paramname"><em>dest_addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>address_length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>bytes_sent</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sends a UDP datagram over a specified socket. </p>
<dl class="section note"><dt>Note</dt><dd>If an ARP entry for the specified destination address is not present in the ARP cache, this function sends an ARP request and waits for <a class="el" href="group__group__secure__sockets__macros.html#ga78a785b81acf34f704c9a4256554e5ce">ARP_WAIT_TIME_IN_MSEC</a> time for MAC address resolution. If the MAC address is not resolved within the timeout, this function returns the error code <a class="el" href="group__group__secure__sockets__results.html#gafe365734cca2ee1ad94cda64aec31d3f">CY_RSLT_MODULE_SECURE_SOCKETS_ARP_TIMEOUT</a>. Upon receiving this error, the caller can retry this API again after a brief delay.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle returned by the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> API function for UDP sockets. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">buffer</td><td>Buffer containing the data to be sent. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>Length of the data to be sent. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">flags</td><td>Flags to indicate send options. Currently, this argument is not used; this is reserved for the future. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">dest_addr</td><td>Pointer to the <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> structure that contains the destination address to send the data to. Refer <a class="el" href="structcy__socket__ip__address__t.html">cy_socket_ip_address_t</a> for IP address endienness. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">address_length</td><td>Length of the <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> structure. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">bytes_sent</td><td>Number of bytes sent.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. On success, it also returns the number of bytes sent. Important error code related to this API function is: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga124cf86b625393915202c81b9873fcde">CY_RSLT_MODULE_SECURE_SOCKETS_NETIF_DOES_NOT_EXIST</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gafe365734cca2ee1ad94cda64aec31d3f">CY_RSLT_MODULE_SECURE_SOCKETS_ARP_TIMEOUT</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga4c4dd80221b242250b7223b5697c2234">CY_RSLT_MODULE_SECURE_SOCKETS_ERROR_ROUTING</a> </dd></dl>

</div>
</div>
<a id="gaeb1269bd36384293539dc749095412f7" name="gaeb1269bd36384293539dc749095412f7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaeb1269bd36384293539dc749095412f7">&#9670;&nbsp;</a></span>cy_socket_recv()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_recv </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flags</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>bytes_received</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Receives the data from a connected TCP/TLS socket. </p>
<dl class="section note"><dt>Note</dt><dd>Ensure that the <a class="el" href="group__group__secure__sockets__functions.html#ga97476da4dcc2f3a411c35b741bf098cc">cy_socket_disconnect</a> API function is called when this API function fails with the CY_RSLT_MODULE_SECURE_SOCKETS_CLOSED error. lwIP doesn't allow the socket to be reused after disconnection. Therefore, the caller should call <a class="el" href="group__group__secure__sockets__functions.html#ga97476da4dcc2f3a411c35b741bf098cc">cy_socket_disconnect</a> and <a class="el" href="group__group__secure__sockets__functions.html#ga3c811410848871c3c4b0721a3b37dc24">cy_socket_delete</a> API functions to delete the closed socket. This is applicable if Secure Sockets Library is built for lwIP network stack.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle returned by either the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> API function for client sockets, or by <a class="el" href="group__group__secure__sockets__functions.html#ga49ede56f180b2bb3e367924f535bb300">cy_socket_accept</a> API function for accepted sockets. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">buffer</td><td>Buffer into which received data will be placed. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>Size of the data buffer. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">flags</td><td>Not currently used. Should be set to <a class="el" href="group__group__secure__sockets__macros.html#ga91444208828cd6b96895d64b879513d4">CY_SOCKET_FLAGS_NONE</a>. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">bytes_received</td><td>Number of bytes received.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. On success, it also returns number of bytes received. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gaa1e29599b933b3e95c49b4a680832f67">CY_RSLT_MODULE_SECURE_SOCKETS_TLS_ERROR</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gae7076deaa42ba4f0c9e80d6d807ecdea">CY_RSLT_MODULE_SECURE_SOCKETS_TCPIP_ERROR</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gac5f5fb81bfb98a38b7b36981f1be2ac7">CY_RSLT_MODULE_SECURE_SOCKETS_TIMEOUT</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gaae6a87e885601b640fba5752a8ec29b4">CY_RSLT_MODULE_SECURE_SOCKETS_CLOSED</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga40143a1ca502f18baf2fc6ea9e48d1a6">CY_RSLT_MODULE_SECURE_SOCKETS_WOULDBLOCK</a> </dd></dl>

</div>
</div>
<a id="ga29df5cbdaa9de0f324cf947454577727" name="ga29df5cbdaa9de0f324cf947454577727"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga29df5cbdaa9de0f324cf947454577727">&#9670;&nbsp;</a></span>cy_socket_recvfrom()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_recvfrom </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flags</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> *&#160;</td>
          <td class="paramname"><em>src_addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>src_addr_length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>bytes_received</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Receives a UDP datagram for the specified socket. </p>
<dl class="section note"><dt>Note</dt><dd><ol type="1">
<li>If the datagram is larger than the supplied buffer, excess bytes in the datagram is discarded.</li>
<li>To receive data from a specific source address, the caller should set <a class="el" href="group__group__secure__sockets__macros.html#gafaf57e8563c58426b2213dc1a0b8c3be">CY_SOCKET_FLAGS_RECVFROM_SRC_FILTER</a> flag in the 'flags' parameter, and assign the source address through the 'src_addr' parameter. If <a class="el" href="group__group__secure__sockets__macros.html#gafaf57e8563c58426b2213dc1a0b8c3be">CY_SOCKET_FLAGS_RECVFROM_SRC_FILTER</a> flag is set and src_addr is NULL, this function returns with the error code <a class="el" href="group__group__secure__sockets__results.html#ga11aea8ad5dfd9ea5de446b30d6db82d6">CY_RSLT_MODULE_SECURE_SOCKETS_BADARG</a>.</li>
</ol>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle returned by either the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> API function for client sockets, or by <a class="el" href="group__group__secure__sockets__functions.html#ga49ede56f180b2bb3e367924f535bb300">cy_socket_accept</a> API function for accepted sockets. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">buffer</td><td>Buffer into which the received data will be placed. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>Size of the data buffer. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">flags</td><td>Flags to control the datagram to be received. Refer <a class="el" href="group__group__secure__sockets__macros.html#gaaa0463c0472f262600893c33d3a40f0a">CY_SOCKET_FLAGS_RECVFROM_NONE</a> and <a class="el" href="group__group__secure__sockets__macros.html#gafaf57e8563c58426b2213dc1a0b8c3be">CY_SOCKET_FLAGS_RECVFROM_SRC_FILTER</a>. </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">src_addr</td><td>Pointer to the <a class="el" href="structcy__socket__sockaddr__t.html">cy_socket_sockaddr_t</a> structure to store the sender's address. If passed as NULL, the sender's address is not returned to the caller. If the <a class="el" href="group__group__secure__sockets__macros.html#gafaf57e8563c58426b2213dc1a0b8c3be">CY_SOCKET_FLAGS_RECVFROM_SRC_FILTER</a> flag is set, it contains the source address from which the datagram to be received. Refer <a class="el" href="structcy__socket__ip__address__t.html">cy_socket_ip_address_t</a> for IP address endienness. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">src_addr_length</td><td>Pointer containing source address length. Currently, this argument is not used; this is reserved for the future. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">bytes_received</td><td>Number of bytes received.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. On success, it returns the number of bytes received. If src_addr is not NULL it also returns sender address. Important error code related to this API function is: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga11aea8ad5dfd9ea5de446b30d6db82d6">CY_RSLT_MODULE_SECURE_SOCKETS_BADARG</a> </dd></dl>

</div>
</div>
<a id="ga02e453d715d77075c59d751f6b07ae8f" name="ga02e453d715d77075c59d751f6b07ae8f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga02e453d715d77075c59d751f6b07ae8f">&#9670;&nbsp;</a></span>cy_socket_setsockopt()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_setsockopt </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>level</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>optname</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>optval</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>optlen</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets a particular socket option. </p>
<p >This API function can be called multiple times for the same socket to set various socket options.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Handle of the socket to set the option for. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">level</td><td>Level at which the option resides:<br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gaf36b6f0f1bc53927d148746fedad7149">CY_SOCKET_SOL_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gab245bb6040c3f680cc38e39e9e3a97d7">CY_SOCKET_SOL_TCP</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga87878a7761a845f17f24f5e52c73f61f">CY_SOCKET_SOL_TLS</a> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">optname</td><td>Socket option to be set: <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga1fcbd0b7ab0d808a7d0a88eaffe04e00">CY_SOCKET_SO_RCVTIMEO</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga6d99d154509bf7293f13ac97b7fd5b68">CY_SOCKET_SO_SNDTIMEO</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga87ddcdfd412485a722122a56495e46c6">CY_SOCKET_SO_NONBLOCK</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga2427b8a6b4a20aca2232c6874ff6867b">CY_SOCKET_SO_TCP_USER_TIMEOUT</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga7fd0bff2f890ddab81f7847a1862c325">CY_SOCKET_SO_CONNECT_REQUEST_CALLBACK</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gaa05dc49b1682f0682d1a4066c641512d">CY_SOCKET_SO_RECEIVE_CALLBACK</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga4a3e35fbb5f577a38a6eafb7d693134a">CY_SOCKET_SO_DISCONNECT_CALLBACK</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga5bdbb8938476af809b4af8f5f7c2da2d">CY_SOCKET_SO_TRUSTED_ROOTCA_CERTIFICATE</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gafa0ac839774a33feeb037dbb0c449cc3">CY_SOCKET_SO_TLS_IDENTITY</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gaa3f2b7a10cc58ae014640a8547949974">CY_SOCKET_SO_SERVER_NAME_INDICATION</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga6bb302019f176eed7e436157fbc085f6">CY_SOCKET_SO_ALPN_PROTOCOLS</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga9ce4ab8fca2ff7306f05f7433835f394">CY_SOCKET_SO_TLS_AUTH_MODE</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga0f0041158626e01c411e117ca6e2c5d5">CY_SOCKET_SO_TLS_MFL</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga6eb3fccf457611f775c37e58442449b3">CY_SOCKET_SO_JOIN_MULTICAST_GROUP</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gaa3b9e9b88b1affecbb653fb1375771e3">CY_SOCKET_SO_LEAVE_MULTICAST_GROUP</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gac562af7498a20fba804f7d14ce8a059c">CY_SOCKET_SO_IP_MULTICAST_TTL</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gaed20b264dc3c370f3136ef8923f5ad89">CY_SOCKET_SO_BROADCAST</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gacaf74e4db4c47e33cf258b1e83c4f3eb">CY_SOCKET_SO_IP_TOS</a> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">optval</td><td>A buffer containing the value of the option to set. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">optlen</td><td>The length of the buffer pointed to by optval.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga11aea8ad5dfd9ea5de446b30d6db82d6">CY_RSLT_MODULE_SECURE_SOCKETS_BADARG</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga78e2f95d77864f1b4c1511246411b593">CY_RSLT_MODULE_SECURE_SOCKETS_ALREADY_CONNECTED</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gafec24692af0732924ead22a68118a926">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_OPTION</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga573fe397cab9144679d5738ac76cb2cd">CY_RSLT_MODULE_SECURE_SOCKETS_ADDRESS_IN_USE</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gaaea93bdacfc849de370d75e3816de6cf">CY_RSLT_MODULE_SECURE_SOCKETS_MAX_MEMBERSHIP_ERROR</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gaa73d6c7fb948ef5025102cb326826086">CY_RSLT_MODULE_SECURE_SOCKETS_MULTICAST_ADDRESS_NOT_REGISTERED</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga2a89a78e3b207e09012dd0c9ed8e49dd">CY_RSLT_MODULE_SECURE_SOCKETS_OPTION_NOT_SUPPORTED</a> </dd></dl>

</div>
</div>
<a id="gaa417ff64790869ca839134b636d0f473" name="gaa417ff64790869ca839134b636d0f473"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa417ff64790869ca839134b636d0f473">&#9670;&nbsp;</a></span>cy_socket_getsockopt()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_getsockopt </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>level</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>optname</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>optval</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>optlen</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Gets the value of a particular socket option. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Handle of the socket to get the option value for. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">level</td><td>Level at which the option resides:<br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gaf36b6f0f1bc53927d148746fedad7149">CY_SOCKET_SOL_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gab245bb6040c3f680cc38e39e9e3a97d7">CY_SOCKET_SOL_TCP</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga87878a7761a845f17f24f5e52c73f61f">CY_SOCKET_SOL_TLS</a> </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">optname</td><td>Socket options: <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga1fcbd0b7ab0d808a7d0a88eaffe04e00">CY_SOCKET_SO_RCVTIMEO</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga6d99d154509bf7293f13ac97b7fd5b68">CY_SOCKET_SO_SNDTIMEO</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga87ddcdfd412485a722122a56495e46c6">CY_SOCKET_SO_NONBLOCK</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gac16c4875566176015ef0769b8950f62a">CY_SOCKET_SO_NWRITE</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga2427b8a6b4a20aca2232c6874ff6867b">CY_SOCKET_SO_TCP_USER_TIMEOUT</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gaa3f2b7a10cc58ae014640a8547949974">CY_SOCKET_SO_SERVER_NAME_INDICATION</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#ga9ce4ab8fca2ff7306f05f7433835f394">CY_SOCKET_SO_TLS_AUTH_MODE</a> <br  />
 <a class="el" href="group__group__secure__sockets__macros.html#gacaf74e4db4c47e33cf258b1e83c4f3eb">CY_SOCKET_SO_IP_TOS</a> </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">optval</td><td>Buffer containing the value of the option to get. </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">optlen</td><td>Length of the option value. It is a value-result argument; the caller provides the size of the buffer pointed to by optval, and is modified by this function on return to indicate the actual size of the value returned.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga11aea8ad5dfd9ea5de446b30d6db82d6">CY_RSLT_MODULE_SECURE_SOCKETS_BADARG</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gafec24692af0732924ead22a68118a926">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_OPTION</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#gadbf2f8f83f4bd800effdd3e58a266ceb">CY_RSLT_MODULE_SECURE_SOCKETS_PROTOCOL_NOT_SUPPORTED</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga2a89a78e3b207e09012dd0c9ed8e49dd">CY_RSLT_MODULE_SECURE_SOCKETS_OPTION_NOT_SUPPORTED</a> </dd></dl>

</div>
</div>
<a id="gaeb05bcbd775c36f5fe3fe9d676329494" name="gaeb05bcbd775c36f5fe3fe9d676329494"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaeb05bcbd775c36f5fe3fe9d676329494">&#9670;&nbsp;</a></span>cy_socket_gethostbyname()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_gethostbyname </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>hostname</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__enums.html#ga97cb501a58195859467b126cf2a2789d">cy_socket_ip_version_t</a>&#160;</td>
          <td class="paramname"><em>ip_ver</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__socket__ip__address__t.html">cy_socket_ip_address_t</a> *&#160;</td>
          <td class="paramname"><em>addr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Resolves a host name using Domain Name Service. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">hostname</td><td>Hostname to resolve. It should be a null-terminated string containing ASCII characters. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ip_ver</td><td>IP version type <a class="el" href="group__group__secure__sockets__enums.html#ga97cb501a58195859467b126cf2a2789d">cy_socket_ip_version_t</a> for which the hostname has to be resolved. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">addr</td><td>IP address of the specified host. Refer <a class="el" href="structcy__socket__ip__address__t.html">cy_socket_ip_address_t</a> for IP address endienness.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>On success it returns CY_RSLT_SUCCESS and the IP address of the specified host. Returns an error code on failure. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga11aea8ad5dfd9ea5de446b30d6db82d6">CY_RSLT_MODULE_SECURE_SOCKETS_BADARG</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga630d23c9249b20e544d6967bb7fad02b">CY_RSLT_MODULE_SECURE_SOCKETS_HOST_NOT_FOUND</a> </dd></dl>

</div>
</div>
<a id="ga3c548fdcc908089b8ff95ad210f4fb64" name="ga3c548fdcc908089b8ff95ad210f4fb64"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3c548fdcc908089b8ff95ad210f4fb64">&#9670;&nbsp;</a></span>cy_socket_poll()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_poll </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>rwflags</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Checks whether data is available on the socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle returned by either the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> API function for client sockets, or by <a class="el" href="group__group__secure__sockets__functions.html#ga49ede56f180b2bb3e367924f535bb300">cy_socket_accept</a> API function for accepted sockets. </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">rwflags</td><td>On input, the flags indicate whether the socket needs to be polled for read/write/read-write operation. On return, the flags are updated to indicate the status of the socket readiness for a read/write/read-write operation. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td>Maximum amount of time in milliseconds to wait before returning. If timeout is zero, the function returns immediately. If timeout is <a class="el" href="group__group__secure__sockets__macros.html#ga4984a6aa9c962e897bfeaf3e948b23eb">CY_SOCKET_NEVER_TIMEOUT</a>, the function waits indefinitely.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>On success, it returns CY_RSLT_SUCCESS. The CY_SOCKET_POLL_READ flag is set in the rwflags parameter if data is available for read. The CY_SOCKET_POLL_WRITE flag is set if the socket is ready for write operations. Returns an error code on failure. Important error codes related to this API function are: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga76b8e494a5c48cb3fb8d84a9a2f200ba">CY_RSLT_MODULE_SECURE_SOCKETS_NOT_CONNECTED</a> </dd></dl>

</div>
</div>
<a id="ga5d118a0eaac0384adc34fccfe89c2b8f" name="ga5d118a0eaac0384adc34fccfe89c2b8f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5d118a0eaac0384adc34fccfe89c2b8f">&#9670;&nbsp;</a></span>cy_socket_shutdown()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_shutdown </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>how</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Shuts down the send and/or receive operation on the given TCP socket. </p>
<dl class="section note"><dt>Note</dt><dd>This API is not applicable for UDP.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">how</td><td>Socket shutdown modes. Supported modes: <a class="el" href="group__group__secure__sockets__macros.html#gafde2c0f411fdf3d3756f8bc22d607894">CY_SOCKET_SHUT_RD</a>, <a class="el" href="group__group__secure__sockets__macros.html#ga6eb71ea24b21ec3450d715592fac3f19">CY_SOCKET_SHUT_WR</a>, and <a class="el" href="group__group__secure__sockets__macros.html#ga30cc929ab95e2820b193a7d1b246baf5">CY_SOCKET_SHUT_RDWR</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. Important error code related to this API function is: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> <a class="el" href="group__group__secure__sockets__results.html#ga11aea8ad5dfd9ea5de446b30d6db82d6">CY_RSLT_MODULE_SECURE_SOCKETS_BADARG</a> </dd></dl>

</div>
</div>
<a id="ga3c811410848871c3c4b0721a3b37dc24" name="ga3c811410848871c3c4b0721a3b37dc24"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3c811410848871c3c4b0721a3b37dc24">&#9670;&nbsp;</a></span>cy_socket_delete()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_socket_delete </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__secure__sockets__typedefs.html#ga12b5aa294d6c930ba50ab730d39ed511">cy_socket_t</a>&#160;</td>
          <td class="paramname"><em>handle</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Releases the resources allocated for the socket by the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> function. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">handle</td><td>Socket handle returned by the <a class="el" href="group__group__secure__sockets__functions.html#ga30bbbf20a277e2a7e622df504b014a4b">cy_socket_create</a> API function. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CY_RSLT_SUCCESS on success; an error code on failure. Important error code related to this API function is: <br  />
 <a class="el" href="group__group__secure__sockets__results.html#ga8ab175e739acbc1da3458c6f2c9980b4">CY_RSLT_MODULE_SECURE_SOCKETS_INVALID_SOCKET</a> </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>Secure Sockets</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
</body>
</html>
